package com.heima.bos.web.action.impl;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.heima.bos.domain.Noticebill;
import com.heima.bos.service.BaseService;
import com.heima.bos.service.NoticebillService;
import com.heima.bos.web.action.NoticebillActionInter;
import com.heima.crm.domain.Customer;
import com.heima.crm.service.CustomerService;
@Controller
@Scope("prototype")
public class NoticebillAction extends BaseAction<Noticebill> implements NoticebillActionInter{
	@Resource
	private NoticebillService noticebillService;
	@Resource
	private CustomerService customerService;
	//属性注入电话号码
	private String phone;
	//通过电话号码查找客户数据回写浏览器
	public String findCustomerByPhoneNum(){
		System.out.println(phone);
		Customer customer = customerService.findCustomerByPhone(phone);
		if(customer != null){
			String[] excludes = new String[]{"decidedzone_id"};
			writeObject2Json(customer, excludes);
		}
		return NONE;
	}
	
	/**
	 * 保存新的业务通知单
	 * @param phone
	 */
	/*public String save(){
		//service的save方法需要重写
		noticebillService.save(entity);
		return NONE;
	}*/
	public void setPhone(String phone) {
		this.phone = phone;
	}
	@Override
	protected BaseService<Noticebill> getService() {
		return noticebillService;
	}
}
